import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
import { VitePWA } from 'vite-plugin-pwa'

export default defineConfig({
  plugins: [
    vue(),
    VitePWA({
      registerType: 'autoUpdate',
      devOptions: { enabled: true },
      manifest: {
        name: 'Xing-api vue3 app',
        // start_url: './index.html',
        display: 'standalone', // 全屏显示
        theme_color: '#d9dadf',
        icons: [{ src: 'pwa-logo.png', sizes: '192x192', type: 'image/png' }]
      }
    })
  ],
  server: {
    port: '8080',
    host: '0.0.0.0',
    hmr: true
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
